package com.liangzhong.model.bag.vo
{
	/**
	 *背包信息 
	 * @author lake
	 * 
	 */	
	public class BagInfoVo
	{
		/**
		 *等级 
		 */		
		public var level				:int = 1;
		/**
		 *等级格子数 
		 */		
		public var levelCells			:Array = [10,15,20,25,30,35,40,45,50];
		/**
		 *等级限制 
		 */		
		public var gradeLimits			:Array = [1,5,10,15,20,25,30,35,40,45];
		/**
		 *欧元需求 
		 */		
		public var euroNeeds			:Array = [0,15000,50000,100000,400000,600000,800000,1000000,5000000];
		/**
		 *默认格子数 
		 */		
		public var defaultCellNum		:int = 40;
		/**
		 *点券所开格子数 
		 */		
		public var cashCellNum			:int;
		/**
		 *已用格子数 
		 */		
		public var useCellNum			:int;
		/**
		 *格子总数 包括锁定的格子 
		 */		
		private var _totalCellNum		:int = 40;
		/**
		 *最大格子数 
		 */		
		public var maxCellNum			:int = 320;
		/**
		 *升级需要等级 
		 */		
		private var _needlevel			:int;
		/**
		 *升级需要欧元 
		 */		
		public var coin					:int;
		/**
		 *下级增加的格子数 
		 */		
		public var nextcell				:int;
		/**
		 *上次升级时间 秒
		 */		
		public var pretime				:Number = 0;
		/**
		 *冷却时间 秒 
		 */		
		public var freezingTime			:Number = 12 * 60 * 60;
		
		public function BagInfoVo()
		{
		}
		/**
		 *解析基本信息 
		 * @param data
		 * 
		 */		
		public function parseBaseInfo(data :Object):void
		{
			level				= data.level;
			defaultCellNum 		= data.defaultcell;
			useCellNum  		= data.usecell;
			cashCellNum 		= data.cashcell;
			needlevel			= data.needlevel;
			coin				= data.coin;
			nextcell			= data.nextcell;
			pretime				= data.pretime;
		}
		/**
		 *获取设置显示总的格子 
		 * @param value
		 * 
		 */		
		public function set totalCellNum(value :int):void
		{
			_totalCellNum = value;
		}
		public function get totalCellNum():int
		{
			var openNum :int = defaultCellNum + cashCellNum;
			var modI :int = openNum / 40;
			_totalCellNum = (modI + 1) * 40;
			if(_totalCellNum >= maxCellNum)
			{
				_totalCellNum = maxCellNum;
			}
			return _totalCellNum;
		}
		/**
		 *获取 增加的格子数
		 * @return 
		 * 
		 */		
		public function get nextAddNum():int
		{
			return 5;
		}
		/**
		 *获取设置needlevel 
		 * @return 
		 * 
		 */		
		public function get needlevel():int
		{
			return gradeLimits[level];
		}
		public function set needlevel(value :int):void
		{
			_needlevel = value;
		}
		/**
		 *获取开格子需要的点券 
		 * @return 
		 * 
		 */		
		public function get needCash():int
		{
			return (cashCellNum / 5 + 1) * 20;
		}
	}
}